<template>
  <div>
    <div class="button">
      <button class="" @click="wechatTest()">分享朋友圈</button>
    </div>

  </div>
</template>

<script>
import {getWeChatUrl} from '../axios/api';
import  share from  'm-share';



//wxConfig: ƒ, init: ƒ, render: ƒ, to: ƒ, popup: ƒ}


export default {
    name: 'Test',
    data() {
      return {

        details:{
          videoTitle:'分享测试',
          coverUrl:'',
        },
        weChatData:{

        },
        // appId:'wx3bb216b3e875ceba',
        // timestamp:'1535969129',
        // nonceStr:'ChkfzBXUDQLxzGSM',
        // signature:'8eb7a0fdefcab165d8c000a2c0e03c1d1646d7e2',
        //wechatUrl:'https://wap.wuyoufang.com'
      }
    },
    methods: {

      /*appId
:
"wx174d95ceb5af8245"
nonceStr
  :
  "2taOxiBWgU0mpO6w"
rawString
  :
  "jsapi_ticket=HoagFKDcsGMVCIY2vOjf9mKNRNZa_NzJDQEVnExOWNTP4DjTn8VA6I2Mo2pgwd0D8IRqrcEDZ1GxZWKM6pkMlg&noncestr=2taOxiBWgU0mpO6w&timestamp=1536134717&url=https://av.wuyoufang.com/api/wechat"
signature
  :
  "a35ad8e7bd357ecb9d385d0df047e8d161748395"
timestamp
  :
  1536134717*/

      wechatTest(){
        getWeChatUrl().then(res => {
          console.log(res);
          this.weChatData = res.data;
          // window.alert('666');
          setTimeout(
            ()=>{
              share.to('wxline', {
                title: this.details.videoTitle,
                link: 'https://wap.wuyoufang.com',
                desc: '123456',
                imgUrl: 'av.wuyoufang.com/assets/img/wechat.png',
                wx: {
                  appId: res.data.appId, // 必填，公众号的唯一标识
                  timestamp: res.data.timestamp, // 必填，生成签名的时间戳
                  nonceStr: res.data.nonceStr, // 必填，生成签名的随机串
                  signature: res.data.signature // 必填，签名
                }
              })
            }
            ,1000);

        })
      }
    }
  }
</script>

<style scoped>
.button{
  margin: 0 auto;
  text-align: center;
  line-height: 5rem;
}
</style>
